import React, { Component } from 'react'
import ReactDOM from 'react-dom'

export default class Demo extends Component {
 state={
    num:0
 }
  render() {
    return (
      <div>
        <div>{this.state.num}</div>
        <button onClick={()=>{
            ReactDOM.flushSync(()=>{
                this.setState({num:this.state.num+1})
            })
            ReactDOM.flushSync(()=>{
                this.setState({num:this.state.num+3})
            })
            ReactDOM.flushSync(()=>{
                this.setState({num:this.state.num+2})
            })
        }}>+</button>
      </div>
    )
  }
}
